﻿@page "/SysPay/Details/{id}"
@using SelfService.ViewModel.SysPayVMs;
@inherits BasePage

<ValidateForm @ref="VForm" Model="@_model" >
    <Row ItemsPerRow="ItemsPerRow.Two" RowType="RowType.Normal">
        <Display @bind-Value="@_model.PatientName"  ShowLabel="true"/>
        <Display @bind-Value="@_model.Entity.PayTypeId" Lookup="@_allSysPayTypes"  ShowLabel="true"/>
        <Display @bind-Value="@_model.Entity.Amount"   ShowLabel="true"/>
        <Display @bind-Value="@_model.Entity.OutOrderNo"   ShowLabel="true"/>
        <Display @bind-Value="@_model.Entity.SerialsNumber"   ShowLabel="true"/>
        <Display @bind-Value="@_model.Entity.PayStatus"   ShowLabel="true"/>
        <Display @bind-Value="@_model.Entity.RefundStatus"   ShowLabel="true"/>
        <Display @bind-Value="@_model.Entity.PayTime"   ShowLabel="true"/>
    </Row>
    <div class="modal-footer table-modal-footer">
        <Button Color="Color.Secondary" Icon="fa fa-close" Text="@WtmBlazor.Localizer["Sys.Close"]" OnClick="OnClose"></Button>
    </div>
</ValidateForm>

@code {

    private SysPayVm _model = null;
    private ValidateForm VForm { get; set; }
    [Parameter]
    public string id { get; set; }
    private List<SelectedItem> _allSysPayTypes = new();

    protected override async Task OnInitializedAsync()
    {
        _allSysPayTypes = await WtmBlazor.Api.CallItemsApi("/api/SysPay/GetSysPayTypes", placeholder: WtmBlazor.Localizer["Sys.All"]);
        var rv = await WtmBlazor.Api.CallAPI<SysPayVm>($"/api/SysPay/{id}");
        _model = rv.Data;
    }

    public void OnClose()
    {
        CloseDialog();
    }

}
